<?php
if (isset($_GET['pagina'])){
	include ('Include/accionesRegistrados.php');
}else{
	include('Include/paginator.class.php');

$sql='SELECT * FROM usuarios';
if ($Base->consulta($sql)) $numFila=$Base->num_filas();

$pages = new Paginator;
$pages->items_total = $numFila;
$pages->mid_range = 9;
$pages->paginate();

echo "<b>". $pages->display_jump_menu() . $pages->display_items_per_page() . "</b>";

$sql='SELECT * FROM registro_usuarios ORDER BY fecha_registro DESC'. $pages->limit;
if ($Base->consulta($sql)) {

echo '	<table style="width:95%; text-align:center; margin-left:auto; margin-right:auto;" cellpadding="0" cellspacing="0">
			<tr class="titulo">
			  <td>E-Mail</td>
			  <td>Nombre</td>
			  <td>Comentarios</td>
			  <td>Registro</td>	
			  <td></td>			  
			</tr>
			';
			$i=1;
			while ($fila=$Base->trae_fila()){
				//if($i%2==0){ $colorA="#DEF1FC";} else{ $colorA="#EEF8FF";}
				$colorA = ($i%2==0)?"#DEF1FC":"#EEF8FF";
				$StColFila = 'background-color:'.$colorA.';'; // Estilo del color de la cada fila
				if(strlen($fila[5]) >30) {
					$content = $fila[5];
					$content = substr($content,0,30).'<p class="puntos">...</p>';
				}else{
					$content = $fila[5];
				}
				echo '
				<tr style='.$StColFila.'>
				  <td class="lineaDer">'.$fila[1].'</td>
				  <td class="lineaDer">'.$fila[2].'</td>
				  <td class="lineaDer">'.$content.'</td>
				  <td class="lineaDer">'.$fila[6].'</td>
				  <td style="height:45px;"><a href="?opc='.$_GET['opc'].'&pagina=E&Id='.$fila[0].'&ver=SI" class="link"><b>Ver</b></a><br /><a href="?opc='.$_GET['opc'].'&pagina=E&Id='.$fila[0].'" class="link"><b>Editar</b></a><br /><a href="?opc='.$_GET['opc'].'&pagina=D&Id='.utf8_encode($fila[0]).'" class="link"><b>Eliminar</b></a></td>
				</tr>
				';	
				$i++;
			}
echo '	</table><br>';
echo '<div align="center"><b>'.$pages->display_pages().'</b></div>';
echo "<br><b>P&aacute;gina $pages->current_page de $pages->num_pages</b>";
}
}
?>

